#include <iostream>
#include <string>

using namespace std;

class person
{
private:

public:
    string name;
    string sex;
    int age;

public : 
    person(string name ,int age ,string sex)
        :name(name), age(age) ,sex(sex)
    {
        cout << "父类有参构造" << endl;
    }
    person()
    {
        name = "未设置姓名";
        age = -1;
        sex = "沃尔玛塑料袋";
        cout << "父类无参构造" << endl;
    }
    ~person()
    {
        cout << "我是父类的析构" << endl ;
    }

};


class student:public person
{
private:

public:
    int id;

public:
    student(string name , string sex ,int age ,int id)
        :person(name , age , sex ) , id(id)
    {
        cout << "子类有参构造" << endl;
    }

    student()
    {
        name = "未设置姓名";
        age  = -1;
        sex  = "沃尔玛塑料袋";
        id   = -1 ;
        cout << "子类无参构造" << endl;
    }
    ~student()
    {
        cout <<"我是子类的析构" << endl ;
    }
public:
    void show_data()
    {
        cout << "姓名 " << name << endl;
        cout << "年龄 " << person::age << endl;
        cout << "性别 " << this->sex << endl;
        cout << "学号 " << this->id << endl;
    }
};



int main(int argc, char const *argv[])
{
    student s1 ;

    s1.name ="张三";
    s1.person::age = 10;
    s1.sex = "男";
    s1.id = 10;
    s1.show_data();
    
    return 0;
}
